package com.bottle.mode;

import lombok.Data;

/**
 * Created by chenyuncong on 2018/9/3.
 */
@Data
public class ReJson<T> {
    private Integer code;
    private Integer type;//  默认：1000普通聊天，1001：添加好友通知，
    private T data;
    private String msg;

    public ReJson() {
    }

    public ReJson(T data) {
        this.data = data;
        this.code = 200;
        this.msg = "成功";
    }

    public ReJson(T data, Integer type) {
        this.code = 200;
        this.type = type;
        this.data = data;
        this.msg = "成功";
    }

    public ReJson(String msg, Integer code) {
        this.msg = msg;
        this.code = code;
    }


    public ReJson(Integer code, T data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
        this.type = 1000;
    }

    public ReJson set(Integer code, T data, Integer type) {
        this.code = code;
        this.type = type;
        this.data = data;
        return this;
    }

    public ReJson set(Integer code, T data, Integer type, String msg) {
        this.code = code;
        this.type = type;
        this.data = data;
        this.msg = msg;
        return this;
    }

}
